/**********************************************************************
* Filename: Proximidade.java
* Created: 2013/05/29
* @author Fernando Brito e Abreu
**********************************************************************/
package org.quasar.airNova.businessLayer;

import java.util.Set;
import java.util.HashSet;
import org.quasar.airNova.persistenceLayer.Database;

public class Proximidade
{
	
	/***********************************************************
	* @return all instances of class Proximidade
	***********************************************************/
	public static Set<Proximidade> allInstances()
	{
		return Database.allInstances(Proximidade.class);
	}
	
	private double distancia;
	private Aeroporto servem;
	private Cidade servidas;
	
	/**********************************************************************
	* Associative constructor
	* @param servem the servem to initialize
	* @param servidas the servidas to initialize
	**********************************************************************/
	public Proximidade(Aeroporto servem, Cidade servidas)
	{
		this.servem = servem;
		this.servidas = servidas;
	}
	
	/**********************************************************************
	* Parameterized constructor
	* @param distancia the distancia to initialize
	* @param servem the servem to initialize
	* @param servidas the servidas to initialize
	**********************************************************************/
	public Proximidade(double distancia, Aeroporto servem, Cidade servidas)
	{
		this.distancia = distancia;
		this.servem = servem;
		this.servidas = servidas;
	}
	
	/**********************************************************************
	* Standard attribute getter
	* @return the distancia of the proximidade
	**********************************************************************/
	public double distancia()
	{
		return distancia;
	}
	
	/**********************************************************************
	* Standard attribute setter
	* @param distancia the distancia to set
	**********************************************************************/
	public void setDistancia(double distancia)
	{
		this.distancia = distancia;
	}
	
	/**********************************************************************
	* ASSOCIATIVE2MEMBER getter for Proximidade[*] <-> Aeroporto[1]
	* @return the servem of the proximidade
	**********************************************************************/
	public Aeroporto servem()
	{
		return servem;
	}
	
	/**********************************************************************
	* ASSOCIATIVE2MEMBER setter for Proximidade[*] <-> Aeroporto[1]
	* @param servem the servem to set
	**********************************************************************/
	public void setServem(Aeroporto servem)
	{
		this.servem = servem;
	}
	
	/**********************************************************************
	* ASSOCIATIVE2MEMBER getter for Proximidade[*] <-> Cidade[1]
	* @return the servidas of the proximidade
	**********************************************************************/
	public Cidade servidas()
	{
		return servidas;
	}
	
	/**********************************************************************
	* ASSOCIATIVE2MEMBER setter for Proximidade[*] <-> Cidade[1]
	* @param servidas the servidas to set
	**********************************************************************/
	public void setServidas(Cidade servidas)
	{
		this.servidas = servidas;
	}
	
	/**********************************************************************
	* Object serializer
	**********************************************************************/
	public String toString()
	{
		return "Proximidade [distancia=" + distancia + ", servem=" + servem + ", servidas=" + servidas + "]";
	}
	
	//	-------------------------------------------------------------------------------
	//	INVARIANTS (TODO)
	/*
	inv proximidadeMaiorQueZeroParaUmaDeterminadoAeroportoECidade
		(self.distancia > 0)
	
	*/
}
